<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
//model('jy_scrm/model')->check_custom();
model('jy_scrm/model')->check_worker('',true);
//注册电商客会员 
$item=pdo_get('jy_scrm_worker',array('userid'=>$_SESSION['openid'],'uniacid'=>$_SESSION['uniacid']));
$item['mymembernum']=pdo_count('jy_scrm_member',array('uniacid'=>$_SESSION['uniacid'],'follow_user_userid'=>$_SESSION['openid']));
$item['myqunnum']=pdo_count('jy_scrm_qun',array('uniacid'=>$_SESSION['uniacid'],'owner'=>$_SESSION['openid']));
$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
$item['daymembernum']=pdo_count('jy_scrm_member',array('uniacid'=>$_SESSION['uniacid'],'follow_user_userid'=>$_SESSION['openid'],'createtime >'=>$daytime));
$item['daygenjinnum']=pdo_count('jy_scrm_worker_linelog',array('uniacid'=>$_SESSION['uniacid'],'workerid'=>$item['id'],'createtime >'=>$daytime));
$item['genjinnum']=pdo_count('jy_scrm_worker_linelog',array('uniacid'=>$_SESSION['uniacid'],'workerid'=>$item['id']));
$link_time[0]=0;
$link_time[1]=$daytime-3*24*3600;
$link_time[2]=$daytime-7*24*3600;
$link_time[3]=$daytime-15*24*3600;
$link_time[4]=$daytime-30*24*3600;
$link_time[5]=$daytime-90*24*3600;
$link_time[6]=$daytime-180*24*3600;
$link_times=$this->link_times;
$statuslist=array();
$buystatus=$this->user_buystatus;
foreach($buystatus as $k=>$v){
	$statuslist[$k]['title']=$v;
	$statuslist[$k]['num']=pdo_count('jy_scrm_member',array('uniacid'=>$_SESSION['uniacid'],'follow_user_userid'=>$_SESSION['openid'],'buystatus'=>$k));
	foreach($link_times as $lk=>$lv){
		$statuslist[$k]['list'][$lk]['title']=$lv;
		$statuslist[$k]['list'][$lk]['num']=pdo_count('jy_scrm_member',array('uniacid'=>$_SESSION['uniacid'],'follow_user_userid'=>$_SESSION['openid'],'buystatus'=>$k,'link_time <='=>$link_time[$lk]));
	}
}
$return['item']=$item;
$return['statuslist']=$statuslist;
$return['buystatus']=0;
set_html('title','会员中心');
exi($return);	
?>